'프로그래밍/비주얼스튜디오 환경설정'에 관한 글 2개

원본 블로그 링크 : http://nving.tistory.com/66

MyMacros -> EnvironmentEvenst에 추가
1
2
3
4
5
6
7
8
9
10
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics '여기까지 기존 모듈
Imports System.IO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Sub MakeUTF8File(ByVal path As String)
    Dim input As New FileStream(path, FileMode.Open)
 
    'Check BOM
    Dim isUTF8 As Boolean = (input.ReadByte = &HEF And input.ReadByte = &HBB And input.ReadByte = &HBF)
    input.Close()
 
    If (Not isUTF8) Then
        Dim s As String
        s = File.ReadAllText(path, System.Text.Encoding.Default)
        File.WriteAllText(path, s, System.Text.Encoding.UTF8)
    End If
End Sub
 
Public Sub DocumentEvents_DocumentSaved(ByVal Document As EnvDTE.Document) Handles DocumentEvents.DocumentSaved
    Dim path As String = Document.FullName
    If Document.Language = "C/C++" Then
        MakeUTF8File(path)
        'DTE.ExecuteCommand("Tools.ExternalCommand1")
    End If
End Sub
 
'이 핸들러는 왠만하면 빼는게 좋다. 라이브러리 파일들을 디버깅 차원에서 열때 자동으로 바꿔버리면 조금 곤란할듯
'Public Sub DocumentEvents_DocumentOpening(ByVal path As String, ByVal flag As Boolean) Handles DocumentEvents.DocumentOpening
'    MakeUTF8File(path)
'End Sub

Tools.ExternalCommand1에 Cppcheck를 지정해서 사용하면 편리합니다.
2011/10/22 08:52 2011/10/22 08:52

덧글을 달아 주세요